package com.jackeysun.app_widget

import android.content.Context
import android.util.AttributeSet
import android.widget.TextView
import androidx.core.view.ViewCompat
import com.jackeysun.widget.CircleProgressDrawable

/**
 *   Created by sunxunchao on 2021/10/29.
 */
class ProgressView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : TextView(context, attrs, defStyleAttr) {

    private val progressDrawable = CircleProgressDrawable(isSolid = true, progressPaintWidth = 30.toFloat())

    init {
        ViewCompat.setBackground(this, progressDrawable)
    }

    fun setProgress(progress: Int = 0, max: Int = 100) {
        progressDrawable.setProgress(progress, max)
    }
}